zepto.init = function(selector, context) {
    var dom
    // If nothing given, return an empty Zepto collection
    //未传参，undefined进行boolean转换，返回空Zepto对象
    // 如果$()未传入参数则走下面这句，如果传入一个参数则为selector，context为null，如果传入两个参数则都不为null
    if (!selector) return zepto.Z()
    // Optimize for string selectors

    //selector是字符串，即css表达式
    /*else if (typeof selector == 'string') {
     //去前后空格
     selector = selector.trim()
     // If it's a html fragment, create nodes from it
     // Note: In both Chrome 21 and Firefox 15, DOM error 12
     // is thrown if the fragment doesn't begin with <
     // 如果是<开头 >结尾  基本的HTML代码时
     if (selector[0] == '<' && fragmentRE.test(selector))
     //调用片段生成dom
     dom = zepto.fragment(selector, RegExp.$1, context), selector = null
     // If there's a context, create a collection on that context first, and select
     // nodes from there
     //如果传递了上下文，在上下文中查找元素
     else if (context !== undefined) return $(context).find(selector)
     // If it's a CSS selector, use it to select nodes.
     //通过css表达式查找元素
     else dom = zepto.qsa(document, selector)
     }*/
    // If a function is given, call it when the DOM is ready
    //如果selector是函数，则在DOM ready的时候执行它
    else if (isFunction(selector)) return $(document).ready(selector)
    // If a Zepto collection is given, just return it
    //如果selector是一个Zepto对象，返回它自己
    else if (zepto.isZ(selector)) return selector
    else {
        // normalize array if an array of nodes is given
        //如果selector是数组，过滤null,undefined
        if (isArray(selector)) dom = compact(selector)
        // Wrap DOM nodes.
        //如果selector是对象,TODO://转换为数组？ 它应是DOM; 注意DOM节点的typeof值也是object，所以在里面还要再进行一次判断
        else if (isObject(selector))
            dom = [selector], selector = null
        // If it's a html fragment, create nodes from it
        //如果selector是复杂的HTML代码，调用片段换成DOM节点
        else if (fragmentRE.test(selector))
            dom = zepto.fragment(selector.trim(), RegExp.$1, context), selector = null
        // If there's a context, create a collection on that context first, and select
        // nodes from there
        //如果存在上下文context，仍在上下文中查找selector
        else if (context !== undefined) return $(context).find(selector)
        // And last but no least, if it's a CSS selector, use it to select nodes.
        // 如果没有给定上下文，在document中查找selector
        else dom = zepto.qsa(document, selector)
    }
    // create a new Zepto collection from the nodes found
    //将查询结果转换成Zepto对象
    return zepto.Z(dom, selector)
}